import request from '@/utils/request'

const api_name = '/course'

export default {
    getById(id) {
        return request({
            url: `${api_name}/getById?id=${id}`,
            method: 'get'
        })
    },
    //课程信息列表
    selectPage(current, limit, course) {
        return request({
            url: `${api_name}/selectPage?current=${current}&limit=${limit}`,
            method: 'post',
            data: course  //使用json
        })
    },
    selectCount() {
        return request({
            url: `${api_name}/selectCount`,
            method: 'get'
        })
    },
    selectCourseGroupByCredit() {
        return request({
            url: `${api_name}/selectCourseGroupByCredit`,
            method: 'get'
        })
    },
    //添加课程
    insert(course) {
        return request({
            url: `${api_name}/add`,
            method: 'post',
            data: course
        })
    },
    //修改课程设置
    updateById(course) {
        return request({
            url: `${api_name}/updateById`,
            method: 'put',
            data: course
        })
    },
    //批量删除
    removeByIds(idList) {
        return request({
            url: `${api_name}/removeByIds`,
            method: 'delete',
            data: idList
        })
    }
}
